import { lazy } from 'react';

// import Login from './pages/Login'
// import Home from './pages/Home'

const Login = lazy(() => import('./pages/Login'))
const Home = lazy(() => import('./pages/Home'))
const WorkCountList = lazy(() => import('./pages/WorkCountList'))
const TaskList = lazy(() => import('./pages/TaskList'))
const Mine = lazy(() => import('./pages/Mine'))
const WorkCountDetail = lazy(() => import('./pages/WorkCountDetail'))


import { createBrowserRouter, createHashRouter, Navigate } from 'react-router-dom';

function Fn() {
    const date = new Date().getTime()
    return <p>{date}</p>
}

const router = [
    {
        path: '/',
        element: <Navigate to='login' />,
    },
    {
        path: 'login',
        element: <Login />,
    },
    {
        path: 'home',
        element: <Home />,
        children: [
            {
                path: 'task',
                element: <TaskList key='all' mode='all' />,
            },
            {
                path: 'work',
                element: <WorkCountList key='all' mode='all' />,
            },
            {
                path: 'mywork',
                element: <WorkCountList key='mine' mode='mine' />,
            },
            {
                path: 'mywork-detail',
                element: <WorkCountDetail key='detail' mode='mine' />,
            },
            {
                path: 'aboutme',
                element: <Mine />,
            }
        ]
    }
]


export function hashRouter() {
    return createHashRouter(router);
}

export function browserRouter() {
    return createBrowserRouter(router);
}